package whf.framework.ext.service;

import java.util.Collections;
import java.util.List;

import whf.framework.entity.TreeNode;
import whf.framework.exception.ServiceNotFoundException;
import whf.framework.ext.dao.MenuItemDAO;
import whf.framework.ext.entity.MenuItem;
import whf.framework.meta.MetaFactory;
import whf.framework.util.BeanFactory;

/**
 * @author wanghaifeng
 * @email king@126.com
 * @modify 2006-06-07
 */
public class MenuItemServiceImp extends whf.framework.service.ServiceImp<MenuItem> implements MenuItemService {

	private MenuItemDAO menuItemDAO;

	public void setMenuItemDAO(MenuItemDAO menuItemDAO) {
		this.menuItemDAO = menuItemDAO;
	}

	public static MenuItemService getMenuItemService() throws ServiceNotFoundException {
		return (MenuItemService)BeanFactory.getService(MetaFactory.findByServiceClass(MenuItemServiceImp.class)) ;
	}

	public List<MenuItem> findChildren(TreeNode parent, String queryString) {
		List<MenuItem> list = this.menuItemDAO.findChildren(parent, queryString);
		Collections.sort(list);
		return list;
	}
} 